<html>
<head>
    @include('v1.common.meta')
    <link rel="stylesheet" href="{{elixir('css/basicdata.css')}}">
</head>
<body>
<div class="yjs-grid">
    <div class="yjs-grid-box">
        <div class="layui-tab">
            @if(Auth::check())
                <div class="layui-container">
                    @if($view==='addData')
                        {{--新增图文视图--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>新增志愿信息</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：新增数据时，存在"<i class="layui-icon">&#xe605;</i>"标识的表单项，建议您自主编辑维护；
                                                </blockquote>
                                            </div>
                                        </div>

                                        <div class="layui-form layui-form-pane" name="majorItemForm"
                                             action="javascript:;" method="POST">
                                            <input type="hidden" name="viewType" value="{{$view}}">

                                            <div class="layui-row">
                                                <label class="layui-form-label" style="width: 150px"><i
                                                            class="layui-icon">&#xe605;</i>请选择类型</label>
                                                <div class="layui-input-block">
                                                    <input type="radio" name="type" value="1" lay-filter="type" title="新增招生目录" checked>
                                                    <input type="radio" name="type" value="2" lay-filter="type" title="新增专业" >
                                                </div>
                                            </div>

                                            <div class="layui-row" id="dir1">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 150px"><i
                                                                    class="layui-icon">&#xe605;</i>招生目录代码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" id="code" name="dir_code"
                                                                   placeholder="请输入招生目录代码"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 150px"><i
                                                                    class="layui-icon">&#xe605;</i>招生目录名称</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" id="name" name="dir_name"
                                                                   placeholder="请输入招生目录名称"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>


                                            <div class="layui-row" id="dir2">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 150px"><i
                                                                    class="layui-icon">&#xe605;</i>至少填报志愿数</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" id="min_number" name="min_number"
                                                                   lay-verify="count"
                                                                   placeholder="请输入至少填报志愿数"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 150px"><i
                                                                    class="layui-icon">&#xe605;</i>至多填报志愿数</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" id="max_number" name="max_number"
                                                                   lay-verify="count"
                                                                   placeholder="请输入至多填报志愿数"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>


                                            <div class="layui-row" id="major1" hidden>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 150px"><i
                                                                    class="layui-icon">&#xe605;</i>专业代码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" id="code" name="code"
                                                                   placeholder="请输入专业代码"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 150px"><i
                                                                    class="layui-icon">&#xe605;</i>专业名称</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" id="name" name="name"
                                                                   placeholder="请输入专业名称"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>


                                            <div class="layui-row" id="major2" hidden>

                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 150px"><i
                                                                    class="layui-icon">&#xe605;</i>所属招生目录</label>
                                                        <div class="layui-input-inline">
                                                        <select name="parent_code"
                                                                lay-filter="parentCode"
                                                                lay-search="">
                                                            <option value="">直接选择或搜索选择</option>
                                                            @foreach($parentMajors as $item)
                                                                <option value="{{$item["code"]}}">{{$item["name"]}}</option>
                                                            @endforeach
                                                        </select>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 150px"><i
                                                                    class="layui-icon">&#xe605;</i>招生计划人数</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" id="count" name="count"
                                                                   lay-verify="count"
                                                                   placeholder="请输入招生计划人数"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">验证码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="captcha" maxlength="4"
                                                                   placeholder="请输入图片验证码" autocomplete="off"
                                                                   lay-verify = "required"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md3">
                                                    <div class="layui-form-item">
                                                        <img class="getLVcode" src="{{ captcha_src('mini') }}"
                                                             width="70px"
                                                             height="34px" style="border: 1px solid green;"/>
                                                        <div class="layui-form-mid layui-word-aux">
                                                            点击图片刷新验证码
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md3">
                                                    {{--隐藏提交--}}
                                                    <button id="toolbarSubmit" type="submit" class="layui-btn"
                                                            lay-filter="toolbarEvent" lay-submit style="display: none;">
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    @elseif($view==='viewData')
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>查看【{{$major['name']}}】专业信息</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：查看数据时，所有表单项均不可修改。
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-form layui-form-pane">
                                            招生目录信息
                                            <hr class="layui-bg-green">
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 120px">招生目录代码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$parent_major['code']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 200px">招生目录(大类专业／方向)</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$parent_major['name']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 130px">至少填报志愿数</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$parent_major['min_number']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 130px">至多填报志愿数</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$parent_major['max_number']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            专业信息
                                            <hr class="layui-bg-blue">
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">专业代码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$major['code']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">专业名称</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$major['name']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md12">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" style="width: 150px">专业招生计划人数</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$major['count']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            时间信息
                                            <hr class="layui-bg-cyan">
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">创建时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$major['created_at']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">更新时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$major['updated_at']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    @else
                        {{--视图类型不正确--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <blockquote class="layui-elem-quote-error">
                                    友情提示：视图类型不正确，无法支持后续操作。
                                </blockquote>
                            </div>
                        </div>
                    @endif
                </div>
            @else
                <div class="layui-container">
                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <blockquote class="layui-elem-quote-error">
                                友情提示：该功能只面向已成功登录系统，并具有相应权限的用户可用。
                            </blockquote>
                        </div>
                    </div>
                </div>
            @endif
        </div>
    </div>
</div>

@include('v1.common.js')
<script src="{{elixir('js/majorItem.js')}}"></script>
</body>
<script type="text/html">
    <input type="hidden" id="rspStatus" value="">
    <input type="hidden" id="rspMsg" value="">
</script>
<style>
    .layui-form-checkbox span{padding:0 10px;height:5%;font-size:14px;background-color:#d2d2d2;color:#fff;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
</style>
</html>